<template>
	 <view>
	<div>
	        <span>我是父组件</span>
	        <myFu ref="childRef" @click="passDataToChild"> 点我向子组件传值</myFu>
			<myFu1 ref="parentRef" @getMessage="getMessage">给我传值</myFu1>
	</div>
	<button v-on:click="handleClick">点击我{{b}}</button>
  </view>
</template>
<script>
import myFu from "@/components/my-fu.vue"
import myFu1 from "@/components/my-fu1.vue"
export default {
	components: {
			myFu,
			myFu1
	},
	data() {
			return {
				tel:1,
                b: this.ccc(),
				list:{}
			}
		},
		
		computed: {
			handle:function() {				
				 // return this.tel+2222;
				  return this.tel+2222;
			}
		},
		
		methods:{
			 passDataToChild(){
				const data = 'Data from parent';
				this.$refs.childRef.getMessage(data+new Date());
			},
			getMessage(e){
				this.$p(e)
				this.$refs.parentRef.msg=this.tel	
			},
			api1:function(){console.log('1')},
			api1(){console.log('2')},
			handleClick() {
				console.log('按钮被点击');
				this.tel=222
			},
			ccc:function(){return '我是this。cc'}
			
		},
		
		onLoad(option) {
			// this.api1()
		},
		watch: {
		  tel(newVal, oldVal) {
			  this.a=0;
			console.log('someData变化了', newVal, oldVal);
		  }
		},
	
		
	}
</script>
<style>
</style>